home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 March / Pc Users extra 6.iso / pshare95 / prog / pvie / pview.exe / data.1 / UDLRFrm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-12-15  |  8.9 KB  |  281 lines

  1. VERSION 5.00
  2. Object = "{B283E211-2CB3-11D0-ADA6-00400520799C}#1.5#0"; "PVTREE.OCX"
  3. Object = "{C0491AA1-2CBA-11D0-ADA6-00400520799C}#1.5#0"; "PVMLTBTN.OCX"
  4. Object = "{1BB282C1-2CB9-11D0-ADA6-00400520799C}#1.5#0"; "PVBUTTON.OCX"
  5. Begin VB.Form UDLRFrm 
  6.    Caption         =   "TreeView"
  7.    ClientHeight    =   5760
  8.    ClientLeft      =   2070
  9.    ClientTop       =   1395
  10.    ClientWidth     =   6990
  11.    LinkTopic       =   "Form1"
  12.    PaletteMode     =   1  'UseZOrder
  13.    ScaleHeight     =   5760
  14.    ScaleWidth      =   6990
  15.    Begin PVTreeViewLib.PVTreeView PTreeView1 
  16.       Height          =   3780
  17.       Left            =   120
  18.       TabIndex        =   1
  19.       Top             =   1800
  20.       Width           =   6015
  21.       _Version        =   65541
  22.       _ExtentX        =   10610
  23.       _ExtentY        =   6668
  24.       _StockProps     =   237
  25.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  26.          Name            =   "MS Sans Serif"
  27.          Size            =   8.25
  28.          Charset         =   0
  29.          Weight          =   400
  30.          Underline       =   0   'False
  31.          Italic          =   0   'False
  32.          Strikethrough   =   0   'False
  33.       EndProperty
  34.       Appearance      =   1
  35.       Sort            =   0   'False
  36.       AlwaysShowSelection=   -1  'True
  37.       ListField       =   ""
  38.    End
  39.    Begin PVButtonLib.PVButton Command1 
  40.       Height          =   495
  41.       Left            =   0
  42.       TabIndex        =   8
  43.       Top             =   840
  44.       Width           =   495
  45.       _Version        =   65541
  46.       _ExtentX        =   873
  47.       _ExtentY        =   873
  48.       _StockProps     =   79
  49.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  50.          Name            =   "MS Sans Serif"
  51.          Size            =   8.25
  52.          Charset         =   0
  53.          Weight          =   400
  54.          Underline       =   0   'False
  55.          Italic          =   0   'False
  56.          Strikethrough   =   0   'False
  57.       EndProperty
  58.       Picture         =   5
  59.       Caption         =   ""
  60.       CustomPicture   =   "UDLRFrm.frx":0000
  61.    End
  62.    Begin PVMultiBtnLib.PVMultiBtn Multibtn1 
  63.       Height          =   435
  64.       Left            =   0
  65.       TabIndex        =   0
  66.       Top             =   120
  67.       Width           =   435
  68.       _Version        =   65541
  69.       _ExtentX        =   767
  70.       _ExtentY        =   767
  71.       _StockProps     =   224
  72.    End
  73.    Begin VB.Label Label6 
  74.       Caption         =   "Click the '+' button to insert a new top level node"
  75.       Height          =   255
  76.       Left            =   600
  77.       TabIndex        =   7
  78.       Top             =   1320
  79.       Width           =   6135
  80.    End
  81.    Begin VB.Label Label5 
  82.       Caption         =   "Double-click an item or hit the Return key to change its text"
  83.       Height          =   255
  84.       Left            =   600
  85.       TabIndex        =   6
  86.       Top             =   1080
  87.       Width           =   6135
  88.    End
  89.    Begin VB.Label Label4 
  90.       Caption         =   "Use the Right arrow or Insert key to insert a new item as the child of the current item"
  91.       Height          =   255
  92.       Left            =   600
  93.       TabIndex        =   5
  94.       Top             =   840
  95.       Width           =   6135
  96.    End
  97.    Begin VB.Label Label3 
  98.       Caption         =   "Use the Left arrow or Delete key to delete the current item and all its chilldren"
  99.       Height          =   255
  100.       Left            =   600
  101.       TabIndex        =   4
  102.       Top             =   600
  103.       Width           =   6135
  104.    End
  105.    Begin VB.Label Label2 
  106.       Caption         =   "Use the Down arrow to change selection to the next item"
  107.       Height          =   255
  108.       Left            =   600
  109.       TabIndex        =   3
  110.       Top             =   360
  111.       Width           =   6135
  112.    End
  113.    Begin VB.Label Label1 
  114.       Caption         =   "Use the Up arrow to change selection to the previous item."
  115.       Height          =   255
  116.       Left            =   600
  117.       TabIndex        =   2
  118.       Top             =   120
  119.       Width           =   6135
  120.    End
  121. Attribute VB_Name = "UDLRFrm"
  122. Attribute VB_GlobalNameSpace = False
  123. Attribute VB_Creatable = False
  124. Attribute VB_PredeclaredId = True
  125. Attribute VB_Exposed = False
  126. Private Sub Command1_Click()
  127. Set root = PTreeView1.Branches
  128. Set NewNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
  129. NewNode.Select pvtNode
  130. Dim ret As String
  131. ret = InputBox("Enter text for item", "Caption", NewNode.Text)
  132. If (ret <> "") Then
  133.    NewNode.Text = ret
  134. End If
  135. End Sub
  136. Private Sub Form_Load()
  137. Dim root As Branch
  138. Dim ParentNode As Branch
  139. Dim ChildNode As Branch
  140. PTreeView1.AutoOpen = True
  141. PTreeView1.EnableLines = True
  142. PTreeView1.EnableMicroBitmaps = True
  143. PTreeView1.EnableBitmaps = True
  144. Set root = PTreeView1.Branches
  145. Set ParentNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
  146. Set ChildNode = ParentNode.Add(pvtPositionInOrder, 0, "Child Node")
  147. Set ChildNode = ParentNode.Add(pvtPositionInOrder, 0, "Child Node")
  148. Set ChildNode = ParentNode.Add(pvtPositionInOrder, 0, "Child Node")
  149. ParentNode.Select 1
  150. Set ParentNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
  151. Set ChildNode = ParentNode.Add(pvtPositionAfter, 0, "Child Node")
  152. End Sub
  153. Private Sub Multibtn1_Down()
  154. Dim root As Branch
  155. Dim node As Branch
  156. Dim NextNode As Branch
  157. Set root = PTreeView1.Branches
  158. Set node = root.Get(pvtGetChild, 0)
  159. If (node.IsValid) Then
  160.    Set NextNode = node.Get(pvtGetNextSelected, 0)
  161.    If (NextNode.IsValid = True) Then
  162.       Rem get the next item in the tree
  163.       Set node = NextNode.Get(pvtGetNextVisible, 0)
  164.       If (node.IsValid = True) Then
  165.          node.Select pvtNode
  166.       Else
  167.          Rem we are at the last item in the tree
  168.       End If
  169.    Else
  170.       Rem select the first item in the tree
  171.       node.Select pvtNode
  172.    End If
  173.    Rem no items in tree, do nothing
  174. End If
  175. End Sub
  176. Private Sub Multibtn1_Left()
  177. Dim root As Branch
  178. Dim node As Branch
  179. Dim NextNode As Branch
  180. Set root = PTreeView1.Branches
  181. Set node = root.Get(pvtGetChild, 0)
  182. If (node.IsValid) Then
  183.    Set NextNode = node.Get(pvtGetNextSelected, 0)
  184.    If (NextNode.IsValid) Then
  185.       NextNode.Remove
  186.    End If
  187. End If
  188. End Sub
  189. Private Sub Multibtn1_Right()
  190. Dim root As Branch
  191. Dim node As Branch
  192. Dim NextNode As Branch
  193. Dim NewNode As Branch
  194. Set root = PTreeView1.Branches
  195. Set node = root.Get(pvtGetChild, 0)
  196. If (node.IsValid) Then
  197.    Set NextNode = node.Get(pvtGetNextSelected, 0)
  198.    If (NextNode.IsValid) Then
  199.       Set NewNode = NextNode.Add(pvtPositionInOrder, 0, "New Node")
  200.       NewNode.Select pvtNode
  201.    Else
  202.       Set NewNode = node.Add(pvtPositionInOrder, 0, "Child Node")
  203.       NewNode.Select pvtNode
  204.    End If
  205.    Set NewNode = root.Add(pvtPositionInOrder, 0, "Parent Node")
  206.    NewNode.Select pvtNode
  207. End If
  208. Dim ret As String
  209. ret = InputBox("Enter text for item", "Caption", NewNode.Text)
  210. If (ret <> "") Then
  211.    NewNode.Text = ret
  212. End If
  213. End Sub
  214. Private Sub Multibtn1_Up()
  215. Dim root As Branch
  216. Dim node As Branch
  217. Dim NextNode As Branch
  218. Set root = PTreeView1.Branches
  219. Set node = root.Get(pvtGetChild, 0)
  220. If (node.IsValid) Then
  221.    Set NextNode = node.Get(pvtGetNextSelected, 0)
  222.    If (NextNode.IsValid) Then
  223.       Rem get the previous item in the tree
  224.       Set node = NextNode.Get(pvtGetPrevVisible, 0)
  225.       If (node.IsValid = True) Then
  226.          node.Select pvtNode
  227.       Else
  228.          Rem we are at the first item in the tree
  229.       End If
  230.    Else
  231.       Rem select the first item in the tree
  232.       node.Select pvtNode
  233.    End If
  234.    Rem no items in tree, do nothing
  235. End If
  236. End Sub
  237. Private Sub PTreeView1_KeyDown(KeyCode As Integer, Shift As Integer)
  238. If (KeyCode = vbKeyLeft Or KeyCode = vbKeyDelete) Then
  239.    Multibtn1_Left
  240. End If
  241. If (KeyCode = vbKeyRight Or KeyCode = vbKeyInsert) Then
  242.    Multibtn1_Right
  243. End If
  244. If (KeyCode = vbKeyReturn) Then
  245.    Set root = PTreeView1.Branches
  246.     Set node = root.Get(pvtGetChild, 0)
  247.    If (node.IsValid) Then
  248.       Set NextNode = node.Get(pvtGetNextSelected, 0)
  249.       If (NextNode.IsValid) Then
  250.          PTreeView1.BeginInPlaceEdit
  251. '         ret = InputBox("Enter text for item", "Caption", NextNode.Text)
  252. '         If (ret <> "") Then
  253. '            NextNode.Text = ret
  254. '         End If
  255.       End If
  256.    End If
  257. End If
  258. End Sub
  259. Private Sub PTreeView1_LButtonDblClick(ByVal node As Branch, ByVal x As Single, ByVal y As Single)
  260. Dim ret As String
  261. If (node Is Nothing = False) Then
  262.     PTreeView1.BeginInPlaceEdit
  263. '   ret = InputBox("Enter text for item", "Caption", node.Text)
  264. '   If (ret <> "") Then
  265. '      node.Text = ret
  266. '   End If
  267. End If
  268. End Sub
  269. Private Sub Select_Click()
  270. If (SelectBox.value) Then
  271. PTreeView1.SelectMode = 2
  272. PTreeView1.SelectMode = 0
  273. End If
  274. End Sub
  275. Private Sub SelectBox_Click()
  276. If (SelectBox.value = 1) Then
  277.    PTreeView1.SelectMode = 2
  278.    PTreeView1.SelectMode = 0
  279. End If
  280. End Sub
  281.